home *** CD-ROM | disk | FTP | other *** search
Text File | 2008-05-21 | 35.4 KB | 1,024 lines |
- package views
- {
- import com.glenpike.search.TextFileSearcher;
- import events.NavigationEvent;
- import events.SearchEvent;
- import flash.accessibility.*;
- import flash.debugger.*;
- import flash.display.*;
- import flash.errors.*;
- import flash.events.*;
- import flash.external.*;
- import flash.filters.*;
- import flash.geom.*;
- import flash.media.*;
- import flash.net.*;
- import flash.printing.*;
- import flash.profiler.*;
- import flash.system.*;
- import flash.text.*;
- import flash.ui.*;
- import flash.utils.*;
- import flash.xml.*;
- import model.PresentationModel;
- import mx.binding.*;
- import mx.collections.ArrayCollection;
- import mx.containers.Canvas;
- import mx.containers.VBox;
- import mx.controls.Alert;
- import mx.controls.Button;
- import mx.controls.Image;
- import mx.controls.ProgressBar;
- import mx.controls.RadioButton;
- import mx.controls.Text;
- import mx.controls.TextInput;
- import mx.core.Repeater;
- import mx.core.UIComponentDescriptor;
- import mx.core.mx_internal;
- import mx.events.FlexEvent;
- import mx.events.PropertyChangeEvent;
- import mx.styles.*;
-
- public class SearchTab extends Canvas
- {
- private static var _watcherSetupUtil:IWatcherSetupUtil;
-
- [Bindable]
- private var _1057894073resultsCount:Text;
-
- private var _bindings:Array;
-
- private var searchMode:String = "magazine";
-
- [Bindable]
- private var _710473164searchTerm:String = "";
-
- private var txtSearch:TextFileSearcher;
-
- public var _bindingsByDestination:Object;
-
- [Bindable]
- private var _1412401219rptText:Array;
-
- private var dir:String = "data/text/";
-
- [Bindable]
- private var _1001078227progress:ProgressBar;
-
- [Bindable]
- private var _1778179843searchBox:VBox;
-
- [Bindable]
- private var _1493698498_VBox2:VBox;
-
- private var _embed_mxml____embedded_assets_search_tab_bg_png_2045520245:Class;
-
- [Bindable]
- private var _1778195246searchRpt:Repeater;
-
- public var _bindingsBeginWithWord:Object;
-
- private var ext:String = ".txt";
-
- [Bindable]
- private var _1857328081presentationModel:PresentationModel;
-
- private var currentResult:int = 0;
-
- [Bindable]
- private var _476548482cancelBtn:Button;
-
- [Bindable]
- private var _682052866searchTxtInput:TextInput;
-
- [Bindable]
- private var _973070101searchInArchive:RadioButton;
-
- [Bindable]
- private var _744247857searchingBox:VBox;
-
- private var _watchers:Array;
-
- [Bindable]
- private var _1880932050searchResults:ArrayCollection;
-
- [Bindable]
- private var _559758042searchInMag:RadioButton;
-
- private var _documentDescriptor_:UIComponentDescriptor;
-
- public function SearchTab()
- {
- _documentDescriptor_ = new UIComponentDescriptor({
- "type":Canvas,
- "propertiesFactory":function():Object
- {
- return {
- "width":206,
- "height":926,
- "childDescriptors":[new UIComponentDescriptor({
- "type":Image,
- "propertiesFactory":function():Object
- {
- return {
- "source":_embed_mxml____embedded_assets_search_tab_bg_png_2045520245,
- "width":206,
- "height":926
- };
- }
- }),new UIComponentDescriptor({
- "type":VBox,
- "id":"searchBox",
- "propertiesFactory":function():Object
- {
- return {
- "x":6,
- "y":48,
- "horizontalScrollPolicy":"off",
- "verticalScrollPolicy":"off",
- "childDescriptors":[new UIComponentDescriptor({
- "type":Text,
- "propertiesFactory":function():Object
- {
- return {
- "text":"What word or phrase would you like to search for?",
- "width":160
- };
- }
- }),new UIComponentDescriptor({
- "type":TextInput,
- "id":"searchTxtInput",
- "events":{
- "focusIn":"__searchTxtInput_focusIn",
- "focusOut":"__searchTxtInput_focusOut"
- },
- "propertiesFactory":function():Object
- {
- return {
- "styleName":"searchTxtInput",
- "text":"search for...",
- "toolTip":"Enter your search terms here"
- };
- }
- }),new UIComponentDescriptor({
- "type":Text,
- "propertiesFactory":function():Object
- {
- return {
- "text":"Where would you like to search?",
- "width":160
- };
- }
- }),new UIComponentDescriptor({
- "type":RadioButton,
- "id":"searchInMag",
- "events":{"click":"__searchInMag_click"},
- "propertiesFactory":function():Object
- {
- return {
- "buttonMode":true,
- "styleName":"searchRadioButton",
- "label":"In the current magazine",
- "groupName":"searchgroup",
- "toolTip":"Click this button to search in the current magazine"
- };
- }
- }),new UIComponentDescriptor({
- "type":RadioButton,
- "id":"searchInArchive",
- "events":{"click":"__searchInArchive_click"},
- "propertiesFactory":function():Object
- {
- return {
- "buttonMode":true,
- "styleName":"searchRadioButton",
- "label":"In the whole archive",
- "groupName":"searchgroup",
- "toolTip":"Click this button to search all the magazines - takes longer"
- };
- }
- }),new UIComponentDescriptor({
- "type":Text,
- "id":"resultsCount",
- "propertiesFactory":function():Object
- {
- return {
- "visible":false,
- "width":160
- };
- }
- }),new UIComponentDescriptor({
- "type":VBox,
- "id":"_VBox2",
- "stylesFactory":function():void
- {
- this.backgroundColor = 14277081;
- },
- "propertiesFactory":function():Object
- {
- return {
- "width":188,
- "height":675,
- "horizontalScrollPolicy":"off",
- "verticalLineScrollSize":10,
- "childDescriptors":[new UIComponentDescriptor({
- "type":Repeater,
- "id":"searchRpt",
- "propertiesFactory":function():Object
- {
- return {"childDescriptors":[new UIComponentDescriptor({
- "type":Text,
- "id":"rptText",
- "events":{
- "rollOver":"__rptText_rollOver",
- "rollOut":"__rptText_rollOut",
- "click":"__rptText_click"
- },
- "propertiesFactory":function():Object
- {
- return {
- "buttonMode":true,
- "selectable":false,
- "styleName":"resultOut"
- };
- }
- })]};
- }
- })]
- };
- }
- })]
- };
- }
- }),new UIComponentDescriptor({
- "type":VBox,
- "id":"searchingBox",
- "stylesFactory":function():void
- {
- this.horizontalAlign = "center";
- },
- "propertiesFactory":function():Object
- {
- return {
- "x":6,
- "y":48,
- "visible":false,
- "childDescriptors":[new UIComponentDescriptor({
- "type":ProgressBar,
- "id":"progress",
- "propertiesFactory":function():Object
- {
- return {
- "indeterminate":true,
- "label":"Searching",
- "width":160
- };
- }
- }),new UIComponentDescriptor({
- "type":Button,
- "id":"cancelBtn",
- "events":{"click":"__cancelBtn_click"},
- "propertiesFactory":function():Object
- {
- return {
- "styleName":"cancelBtn",
- "label":"Cancel"
- };
- }
- })]
- };
- }
- })]
- };
- }
- });
- _710473164searchTerm = "";
- searchMode = "magazine";
- dir = "data/text/";
- ext = ".txt";
- currentResult = 0;
- _embed_mxml____embedded_assets_search_tab_bg_png_2045520245 = SearchTab__embed_mxml____embedded_assets_search_tab_bg_png_2045520245;
- super();
- mx_internal::_document = this;
- this.width = 206;
- this.height = 926;
- this.verticalScrollPolicy = "off";
- this.horizontalScrollPolicy = "off";
- this.addEventListener("creationComplete",___Canvas1_creationComplete);
- }
-
- public static function set watcherSetupUtil(param1:IWatcherSetupUtil) : void
- {
- SearchTab._watcherSetupUtil = param1;
- }
-
- public function __searchInArchive_click(param1:MouseEvent) : void
- {
- searchRadioChangeHandler(param1);
- }
-
- private function message(param1:String) : void
- {
- Alert.show(param1,"Hint");
- }
-
- public function prevResult() : void
- {
- --currentResult;
- if(0 <= currentResult)
- {
- showResult(searchResults.getItemAt(currentResult));
- }
- else
- {
- currentResult = 0;
- }
- }
-
- private function searchFocusInHandler(param1:Event) : void
- {
- if("search for..." == searchTxtInput.text)
- {
- searchTxtInput.text = "";
- }
- }
-
- [Bindable(event="propertyChange")]
- public function get rptText() : Array
- {
- return this._1412401219rptText;
- }
-
- private function fileStart(param1:SearchEvent) : void
- {
- var _loc2_:String = null;
- var _loc3_:RegExp = null;
- var _loc4_:String = null;
- var _loc5_:String = null;
- _loc2_ = param1.eventData.toString();
- _loc3_ = /data\/text\/([0-9]+)\/([0-9]+)\s([A-Za-z]+)\s([0-9]+)\.txt/gi;
- _loc4_ = _loc2_.replace(_loc3_,"$3");
- _loc5_ = _loc2_.replace(_loc3_,"$1");
- progress.label = "Searching " + _loc4_ + " " + _loc5_;
- }
-
- [Bindable(event="propertyChange")]
- public function get _VBox2() : VBox
- {
- return this._1493698498_VBox2;
- }
-
- public function set progress(param1:ProgressBar) : void
- {
- var _loc2_:Object = null;
- _loc2_ = this._1001078227progress;
- if(_loc2_ !== param1)
- {
- this._1001078227progress = param1;
- dispatchEvent(PropertyChangeEvent.createUpdateEvent(this,"progress",_loc2_,param1));
- }
- }
-
- public function set searchingBox(param1:VBox) : void
- {
- var _loc2_:Object = null;
- _loc2_ = this._744247857searchingBox;
- if(_loc2_ !== param1)
- {
- this._744247857searchingBox = param1;
- dispatchEvent(PropertyChangeEvent.createUpdateEvent(this,"searchingBox",_loc2_,param1));
- }
- }
-
- private function searchFocusOutHandler(param1:Event) : void
- {
- if("" == searchTxtInput.text)
- {
- searchTxtInput.text = "search for...";
- }
- }
-
- private function set searchTerm(param1:String) : void
- {
- var _loc2_:Object = null;
- _loc2_ = this._710473164searchTerm;
- if(_loc2_ !== param1)
- {
- this._710473164searchTerm = param1;
- dispatchEvent(PropertyChangeEvent.createUpdateEvent(this,"searchTerm",_loc2_,param1));
- }
- }
-
- public function set rptText(param1:Array) : void
- {
- var _loc2_:Object = null;
- _loc2_ = this._1412401219rptText;
- if(_loc2_ !== param1)
- {
- this._1412401219rptText = param1;
- dispatchEvent(PropertyChangeEvent.createUpdateEvent(this,"rptText",_loc2_,param1));
- }
- }
-
- public function set presentationModel(param1:PresentationModel) : void
- {
- var _loc2_:Object = null;
- _loc2_ = this._1857328081presentationModel;
- if(_loc2_ !== param1)
- {
- this._1857328081presentationModel = param1;
- dispatchEvent(PropertyChangeEvent.createUpdateEvent(this,"presentationModel",_loc2_,param1));
- }
- }
-
- [Bindable(event="propertyChange")]
- public function get presentationModel() : PresentationModel
- {
- return this._1857328081presentationModel;
- }
-
- public function set _VBox2(param1:VBox) : void
- {
- var _loc2_:Object = null;
- _loc2_ = this._1493698498_VBox2;
- if(_loc2_ !== param1)
- {
- this._1493698498_VBox2 = param1;
- dispatchEvent(PropertyChangeEvent.createUpdateEvent(this,"_VBox2",_loc2_,param1));
- }
- }
-
- private function startSearch() : void
- {
- var _loc1_:Array = null;
- _loc1_ = _makeFileList();
- trace("will search in " + _loc1_.length + " files");
- txtSearch.addEventListener(SearchEvent.FILE_START,fileStart);
- if(false == txtSearch.searchFor(searchTerm,_loc1_))
- {
- trace("Could not start search");
- searchInMag.selected = false;
- searchInArchive.selected = false;
- Alert.show("There was a problem searching - some common words may be ignored so please try again.");
- return;
- }
- searchResults = null;
- resultsCount.text = "";
- searchBox.visible = false;
- searchingBox.visible = true;
- }
-
- private function rollOutHandler(param1:Event) : void
- {
- if(param1.target.repeaterIndex != currentResult)
- {
- param1.currentTarget.styleName = "resultOut";
- }
- }
-
- public function __cancelBtn_click(param1:MouseEvent) : void
- {
- cancelHandler(param1);
- }
-
- private function clickHandler(param1:Event) : void
- {
- var _loc2_:* = undefined;
- currentResult = param1.currentTarget.repeaterIndex;
- _loc2_ = param1.currentTarget.getRepeaterItem();
- trace("searchResult item " + _loc2_);
- showResult(_loc2_);
- }
-
- private function searchCancelled(param1:SearchEvent) : void
- {
- txtSearch.removeEventListener(SearchEvent.FILE_START,fileStart);
- searchInMag.selected = false;
- searchInArchive.selected = false;
- searchingBox.visible = false;
- searchBox.visible = true;
- }
-
- private function searchRadioChangeHandler(param1:Event) : void
- {
- var _loc2_:String = null;
- trace("search Radio changed " + param1.target + " - " + presentationModel.numPages);
- if(param1.target == searchInArchive)
- {
- searchMode = "archive";
- }
- else
- {
- searchMode = "magazine";
- if(-1 == presentationModel.numPages)
- {
- trace("-1 == numPages");
- message("Use \'Browse By Cover\' to choose a magazine or search the whole archive.");
- return;
- }
- }
- searchTerm = searchTxtInput.text;
- _loc2_ = searchTerm.replace(/[\W]/gi,"");
- if(0 == searchTerm.length || 0 == _loc2_.length || "search for..." == searchTerm)
- {
- searchInMag.selected = false;
- searchInArchive.selected = false;
- Alert.show("Please enter a search phrase containing letters and/or numbers and try again");
- return;
- }
- startSearch();
- }
-
- [Bindable(event="propertyChange")]
- public function get searchTxtInput() : TextInput
- {
- return this._682052866searchTxtInput;
- }
-
- public function nextResult() : void
- {
- ++currentResult;
- if(searchResults.length - 1 >= currentResult)
- {
- showResult(searchResults.getItemAt(currentResult));
- }
- else
- {
- currentResult = searchResults.length - 1;
- }
- }
-
- [Bindable(event="propertyChange")]
- public function get searchInMag() : RadioButton
- {
- return this._559758042searchInMag;
- }
-
- [Bindable(event="propertyChange")]
- public function get searchResults() : ArrayCollection
- {
- return this._1880932050searchResults;
- }
-
- private function _SearchTab_bindingsSetup() : void
- {
- var binding:Binding = null;
- if(!_bindings)
- {
- _bindings = [];
- }
- if(!_watchers)
- {
- _watchers = [];
- }
- binding = new Binding(this,function():Boolean
- {
- return -1 != presentationModel.numPages ? true : false;
- },function(param1:Boolean):void
- {
- searchInMag.enabled = param1;
- },"searchInMag.enabled");
- _bindings[0] = binding;
- binding = new Binding(this,function():Object
- {
- return searchResults;
- },function(param1:Object):void
- {
- searchRpt.dataProvider = param1;
- },"searchRpt.dataProvider");
- _bindings[1] = binding;
- binding = new RepeatableBinding(this,function(param1:Array, param2:Array):String
- {
- var _loc3_:* = undefined;
- var _loc4_:* = undefined;
- _loc3_ = formatText(searchRpt.mx_internal::getItemAt(param2[0]));
- return _loc3_ == undefined ? null : String(_loc3_);
- },function(param1:String, param2:Array):void
- {
- rptText[param2[0]].htmlText = param1;
- },"rptText.htmlText");
- _bindings[2] = binding;
- }
-
- private function init() : void
- {
- txtSearch = new TextFileSearcher();
- txtSearch.addEventListener(Event.COMPLETE,searchComplete);
- txtSearch.addEventListener(SearchEvent.CANCELLED,searchCancelled);
- }
-
- public function __searchInMag_click(param1:MouseEvent) : void
- {
- searchRadioChangeHandler(param1);
- }
-
- public function set resultsCount(param1:Text) : void
- {
- var _loc2_:Object = null;
- _loc2_ = this._1057894073resultsCount;
- if(_loc2_ !== param1)
- {
- this._1057894073resultsCount = param1;
- dispatchEvent(PropertyChangeEvent.createUpdateEvent(this,"resultsCount",_loc2_,param1));
- }
- }
-
- private function showResult(param1:Object) : void
- {
- var _loc2_:int = 0;
- var _loc3_:Text = null;
- trace("showResult " + currentResult);
- _loc2_ = 0;
- while(_loc2_ < searchResults.length)
- {
- _loc3_ = rptText[_loc2_];
- if(_loc2_ == currentResult)
- {
- _loc3_.styleName = "resultOver";
- }
- else
- {
- _loc3_.styleName = "resultOut";
- }
- trace("selTxt " + _loc3_ + " at " + _loc2_ + " style " + _loc3_.styleName);
- _loc2_++;
- }
- dispatchEvent(new NavigationEvent(NavigationEvent.SHOW_SEARCH_RESULT,param1,true,false));
- }
-
- [Bindable(event="propertyChange")]
- public function get cancelBtn() : Button
- {
- return this._476548482cancelBtn;
- }
-
- public function __rptText_rollOut(param1:MouseEvent) : void
- {
- rollOutHandler(param1);
- }
-
- public function __searchTxtInput_focusIn(param1:FocusEvent) : void
- {
- searchFocusInHandler(param1);
- }
-
- private function formatText(param1:Object) : String
- {
- var _loc2_:String = null;
- var _loc3_:String = null;
- _loc3_ = formatPage(param1.page,param1.numPages,param1.twoPageBack);
- return "<p><b>" + param1.month + " " + param1.year + "<br>page " + _loc3_ + " (x" + param1.count + ")</b></p>";
- }
-
- public function simpleSearch(param1:String) : void
- {
- if(0 == param1.length)
- {
- searchInMag.selected = false;
- searchInArchive.selected = false;
- Alert.show("Please enter a search term and try again");
- return;
- }
- searchTerm = searchTxtInput.text = param1;
- searchMode = "magazine";
- searchInMag.selected = true;
- searchInArchive.selected = false;
- startSearch();
- }
-
- public function set searchBox(param1:VBox) : void
- {
- var _loc2_:Object = null;
- _loc2_ = this._1778179843searchBox;
- if(_loc2_ !== param1)
- {
- this._1778179843searchBox = param1;
- dispatchEvent(PropertyChangeEvent.createUpdateEvent(this,"searchBox",_loc2_,param1));
- }
- }
-
- public function __searchTxtInput_focusOut(param1:FocusEvent) : void
- {
- searchFocusOutHandler(param1);
- }
-
- private function _makeFileList() : Array
- {
- var _loc1_:Array = null;
- var _loc2_:int = 0;
- var _loc3_:int = 0;
- var _loc4_:Object = null;
- var _loc5_:String = null;
- var _loc6_:ArrayCollection = null;
- var _loc7_:int = 0;
- var _loc8_:int = 0;
- var _loc9_:Object = null;
- _loc1_ = new Array();
- if("magazine" == searchMode)
- {
- _loc1_.push(this.dir + presentationModel.yearString + "/" + presentationModel.filePrefix + this.ext);
- }
- else
- {
- _loc2_ = presentationModel.years.length;
- _loc3_ = 0;
- while(_loc3_ < _loc2_)
- {
- _loc4_ = presentationModel.years.getItemAt(_loc3_);
- _loc5_ = _loc4_.value;
- _loc6_ = _loc4_.issue;
- _loc7_ = _loc6_.length;
- _loc8_ = 0;
- while(_loc8_ < _loc7_)
- {
- _loc9_ = _loc6_.getItemAt(_loc8_);
- _loc1_.push(this.dir + _loc5_ + "/" + _loc9_.file + this.ext);
- _loc8_++;
- }
- _loc3_++;
- }
- }
- return _loc1_;
- }
-
- [Bindable(event="propertyChange")]
- public function get progress() : ProgressBar
- {
- return this._1001078227progress;
- }
-
- [Bindable(event="propertyChange")]
- public function get searchingBox() : VBox
- {
- return this._744247857searchingBox;
- }
-
- [Bindable(event="propertyChange")]
- private function get searchTerm() : String
- {
- return this._710473164searchTerm;
- }
-
- public function set searchTxtInput(param1:TextInput) : void
- {
- var _loc2_:Object = null;
- _loc2_ = this._682052866searchTxtInput;
- if(_loc2_ !== param1)
- {
- this._682052866searchTxtInput = param1;
- dispatchEvent(PropertyChangeEvent.createUpdateEvent(this,"searchTxtInput",_loc2_,param1));
- }
- }
-
- public function set searchInArchive(param1:RadioButton) : void
- {
- var _loc2_:Object = null;
- _loc2_ = this._973070101searchInArchive;
- if(_loc2_ !== param1)
- {
- this._973070101searchInArchive = param1;
- dispatchEvent(PropertyChangeEvent.createUpdateEvent(this,"searchInArchive",_loc2_,param1));
- }
- }
-
- public function set searchInMag(param1:RadioButton) : void
- {
- var _loc2_:Object = null;
- _loc2_ = this._559758042searchInMag;
- if(_loc2_ !== param1)
- {
- this._559758042searchInMag = param1;
- dispatchEvent(PropertyChangeEvent.createUpdateEvent(this,"searchInMag",_loc2_,param1));
- }
- }
-
- public function set searchRpt(param1:Repeater) : void
- {
- var _loc2_:Object = null;
- _loc2_ = this._1778195246searchRpt;
- if(_loc2_ !== param1)
- {
- this._1778195246searchRpt = param1;
- dispatchEvent(PropertyChangeEvent.createUpdateEvent(this,"searchRpt",_loc2_,param1));
- }
- }
-
- public function set searchResults(param1:ArrayCollection) : void
- {
- var _loc2_:Object = null;
- _loc2_ = this._1880932050searchResults;
- if(_loc2_ !== param1)
- {
- this._1880932050searchResults = param1;
- dispatchEvent(PropertyChangeEvent.createUpdateEvent(this,"searchResults",_loc2_,param1));
- }
- }
-
- public function ___Canvas1_creationComplete(param1:FlexEvent) : void
- {
- init();
- }
-
- [Bindable(event="propertyChange")]
- public function get resultsCount() : Text
- {
- return this._1057894073resultsCount;
- }
-
- public function __rptText_click(param1:MouseEvent) : void
- {
- clickHandler(param1);
- }
-
- public function set cancelBtn(param1:Button) : void
- {
- var _loc2_:Object = null;
- _loc2_ = this._476548482cancelBtn;
- if(_loc2_ !== param1)
- {
- this._476548482cancelBtn = param1;
- dispatchEvent(PropertyChangeEvent.createUpdateEvent(this,"cancelBtn",_loc2_,param1));
- }
- }
-
- [Bindable(event="propertyChange")]
- public function get searchInArchive() : RadioButton
- {
- return this._973070101searchInArchive;
- }
-
- private function searchComplete(param1:Event) : void
- {
- var _loc2_:Array = null;
- var _loc3_:Array = null;
- var _loc4_:RegExp = null;
- var _loc5_:int = 0;
- var _loc6_:int = 0;
- var _loc7_:String = null;
- var _loc8_:String = null;
- var _loc9_:ArrayCollection = null;
- var _loc10_:Object = null;
- var _loc11_:int = 0;
- var _loc12_:String = null;
- var _loc13_:Array = null;
- var _loc14_:int = 0;
- var _loc15_:int = 0;
- var _loc16_:Object = null;
- var _loc17_:String = null;
- var _loc18_:Object = null;
- _loc2_ = txtSearch.results;
- _loc3_ = new Array();
- _loc4_ = /data\/text\/([0-9]+)\/([0-9]+)\s([A-Za-z]+)\s([0-9]+)\.txt/gi;
- _loc5_ = int(_loc2_.length);
- _loc6_ = 0;
- _loc7_ = "";
- _loc8_ = "";
- trace("search Complete for " + _loc5_ + " files");
- _loc11_ = 0;
- while(_loc11_ < _loc5_)
- {
- _loc12_ = _loc2_[_loc11_].file;
- _loc13_ = _loc2_[_loc11_].indexes;
- if(null != _loc13_)
- {
- _loc14_ = int(_loc13_.length);
- trace("file " + _loc12_ + " has " + _loc14_ + " results");
- _loc15_ = 0;
- while(_loc15_ < _loc14_)
- {
- _loc16_ = _loc13_[_loc15_];
- _loc16_.year = _loc12_.replace(_loc4_,"$1");
- _loc16_.month = _loc12_.replace(_loc4_,"$3");
- _loc17_ = _loc12_.replace(_loc4_,"$2 $3 $4");
- if(_loc7_ != _loc16_.year)
- {
- _loc15_ = 0;
- while(_loc15_ < presentationModel.years.length)
- {
- _loc18_ = presentationModel.years.getItemAt(_loc15_);
- if(_loc16_.year == _loc18_.value)
- {
- _loc9_ = _loc18_.issue;
- _loc7_ = _loc16_.year;
- break;
- }
- _loc15_++;
- }
- }
- if(_loc8_ != _loc16_.month)
- {
- _loc15_ = 0;
- while(_loc15_ < _loc9_.length)
- {
- _loc18_ = _loc9_.getItemAt(_loc15_);
- if(_loc17_ == _loc18_.file)
- {
- _loc10_ = _loc18_;
- _loc8_ = _loc16_.month;
- break;
- }
- _loc15_++;
- }
- }
- _loc16_.numPages = _loc2_[_loc11_].numPages;
- _loc16_.twoPageBack = _loc10_.twoPageBack;
- _loc3_.push(_loc16_);
- _loc6_++;
- _loc15_++;
- }
- }
- _loc11_++;
- }
- txtSearch.removeEventListener(SearchEvent.FILE_START,fileStart);
- searchInMag.selected = false;
- searchInArchive.selected = false;
- searchBox.visible = true;
- searchingBox.visible = false;
- resultsCount.text = _loc6_ + " results";
- resultsCount.visible = true;
- currentResult = 0;
- searchResults = new ArrayCollection(_loc3_);
- }
-
- private function formatPage(param1:int, param2:int, param3:Boolean) : String
- {
- var _loc4_:* = null;
- var _loc5_:int = 0;
- if(-1 == param1 || -1 == param2)
- {
- return "";
- }
- _loc4_ = param1.toString();
- if(0 == param1)
- {
- _loc4_ = "1";
- }
- else if(param1 == param2 - 1 && false == param3)
- {
- _loc4_ = param1 * 2 + "";
- }
- else
- {
- _loc5_ = param1 * 2;
- _loc4_ = "" + _loc5_ + " & " + ++_loc5_;
- }
- return _loc4_;
- }
-
- [Bindable(event="propertyChange")]
- public function get searchRpt() : Repeater
- {
- return this._1778195246searchRpt;
- }
-
- private function _SearchTab_bindingExprs() : void
- {
- var _loc1_:* = undefined;
- _loc1_ = -1 != presentationModel.numPages ? true : false;
- _loc1_ = searchResults;
- _loc1_ = formatText(searchRpt.currentItem);
- }
-
- [Bindable(event="propertyChange")]
- public function get searchBox() : VBox
- {
- return this._1778179843searchBox;
- }
-
- private function rollOverHandler(param1:Event) : void
- {
- param1.currentTarget.styleName = "resultOver";
- }
-
- public function __rptText_rollOver(param1:MouseEvent) : void
- {
- rollOverHandler(param1);
- }
-
- private function cancelHandler(param1:Event) : void
- {
- txtSearch.cancel();
- }
-
- override public function initialize() : void
- {
- var target:SearchTab = null;
- var watcherSetupUtilClass:Object = null;
- mx_internal::setDocumentDescriptor(_documentDescriptor_);
- _SearchTab_bindingsSetup();
- target = this;
- if(_watcherSetupUtil == null)
- {
- watcherSetupUtilClass = getDefinitionByName("_views_SearchTabWatcherSetupUtil");
- watcherSetupUtilClass["init"](null);
- }
- _watcherSetupUtil.setup(this,function(param1:String):*
- {
- return target[param1];
- },_bindings,_watchers);
- super.initialize();
- }
- }
- }
-
-